﻿using System;
using System.Data;
using TimKen.DataAccess;
namespace TimKen.BussLogic
{
    /// <summary>
    /// 收藏夹管理类
    /// </summary>
    public class FavoriteManager
    {
        private readonly TimKen.DataAccess.FavoriteDAO dal = new TimKen.DataAccess.FavoriteDAO();
        public FavoriteManager()
        { }
        #region  成员方法

        /// <summary>
        /// 得到最大ID
        /// </summary>
        public int GetMaxId()
        {
            return dal.GetMaxId();
        }

        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(string UserName, int ProductID)
        {
            return dal.Exists(UserName, ProductID);
        }

        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(TimKen.DataEntity.Favorite model)
        {
            if (Exists(model.UserName, model.ProductID))
                return;
            dal.Add(model);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(TimKen.DataEntity.Favorite model)
        {
            dal.Update(model);
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public void Delete(string UserName, int ProductID)
        {

            dal.Delete(UserName, ProductID);
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public TimKen.DataEntity.Favorite GetModel(string UserName, int ProductID)
        {

            return dal.GetModel(UserName, ProductID);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            return dal.GetList(strWhere);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetAllList()
        {
            return GetList("");
        }

        public DataSet GetPageList(int PageSize, int PageIndex, string userName, int languageID)
        {
            return dal.GetPageList(PageSize, PageIndex, userName, languageID);
        }

        #endregion  成员方法
    }
}

